package com.github.androiddevelopmentframework;

import android.app.Application;

import com.github.freewu.commons.db.DBUtils;
import com.github.freewu.commons.db.DbInfo;
import com.github.freewu.commons.http.HttpUtils;
import com.github.freewu.commons.utils.SystemUtils;
import com.github.freewu.mvp.bean.Mvp;
import com.github.freewu.mvp.bean.MvpConfig;

/**
 * Created by free on 16-7-19.
 */
public class AppApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        MvpConfig mvpConfig = new MvpConfig();

        mvpConfig.setBaseColor(R.color.colorPrimary);
        mvpConfig.setmStyle(R.style.AppTheme);

        Mvp.init(mvpConfig);

        DBUtils.init(getApplicationContext());

        addDB();

        HttpUtils.init("http://mob.huanghuai.edu.cn/",getApplicationContext());
    }
    private void addDB(){
        DbInfo dbInfo=new DbInfo();
        dbInfo.setDbName("db1");
        dbInfo.setVersion(SystemUtils.getVersionCode(getApplicationContext()));

        DBUtils.addDBInfo(dbInfo);

        DbInfo dbInfo2=new DbInfo();
        dbInfo2.setDbName("db2");
        dbInfo2.setSqlPath("sql/db2.sql");
        dbInfo2.setVersion(SystemUtils.getVersionCode(getApplicationContext()));

        DBUtils.addDBInfo(dbInfo2);
    }
}
